<template>
	<view>

	</view>
</template>

<script>
	import tim from '@/common/utils/tim';
	export default {
		data() {
			return {
				messageList: []
			}
		},
		onLoad(options) {
			// 获取当前会话信息
			this.conversationID = options.conversationID;
			this.getHistoryMessages();
		},
		methods: {
			async getHistoryMessages() {
				const res = await tim.getMessageList({
					conversationID: this.conversationID
				});
				this.messageList = res.data.messageList;
			},
			sendTextMessage() {
				const message = tim.createTextMessage({
					to: this.conversationID,
					conversationType: this.isGroup ? TIM.TYPES.CONV_GROUP : TIM.TYPES.CONV_C2C,
					payload: {
						text: this.messageText
					}
				});

				tim.sendMessage(message).then(() => {
					// 发送成功处理
				});
			}
		}
	}
</script>

<style>

</style>